package com.Maykk.Demo03;

/**
 * @ClassName: JoinTest
 * @Description: TODO join 的测试类
 * @Author: MaykkStar@163.com
 */
public class JoinTest {
    public static void main(String[] args) throws InterruptedException {
        // MyThread mt01 = new MyThread("张三");
        // MyThread mt02 = new MyThread("李四");
        // MyThread mt03 = new MyThread("王五");
        MyRunnable myRun = new MyRunnable();
        Thread mt01 = new Thread(myRun,"张三");
        Thread mt02 = new Thread(myRun,"李四");
        Thread mt03 = new Thread(myRun,"王五");

        mt01.start();

        // join 等待当前线程死亡
        // join 的用处是必须等张三报完菜名才能轮到李四和王五抢线程
        mt01.join();

        mt02.start();
        mt03.start();
    }
}
